package com.sky.controller.admin;

import com.sky.result.Result;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

/**
 * @author zcf
 */
@RestController
@RequestMapping("/admin/common")
public class UploadController1 {
    @PostMapping("/upload")
    public Result<String> upload(MultipartFile file)  {

            if (!file.isEmpty()) {
                String path = "D:/img/";

                return Result.success(path + file.getOriginalFilename());
            }
            return Result.error("上传失败");
    }
}
